package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonPage;
import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.Admin;
import com.ytjj.qmyx.admin.model.OrderProblemMessage;
import com.ytjj.qmyx.admin.service.OrderProblemMessageService;
import com.ytjj.qmyx.admin.utils.UserUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 订单问题消息接口
 */
@RestController
@RequestMapping("orderMessage")
@Slf4j
public class OrderProblemMessageController {

    @Resource
    private OrderProblemMessageService orderProblemMessageService;

    /**
     * 查询未读消息列表
     * @return
     */
    @GetMapping("/queryMessage")
    public CommonResult<CommonPage<OrderProblemMessage>> queryMessage(Integer pageNum, Integer pageSize) {
        Admin admin = UserUtil.getAdmin();
        return CommonResult.success(orderProblemMessageService.queryMessage(admin,pageNum,pageSize));
    }

    /**
     * 查看详情
     * @param id
     * @return
     */
    @GetMapping("/findById")
    public CommonResult<OrderProblemMessage> findById(@RequestParam(value = "id") Integer id) {
        return CommonResult.success(orderProblemMessageService.findById(id));
    }


}
